package com.wx.day06.Test1.Json;

import com.wx.day06.Test1.Param.Person;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@ResponseBody//直接返回字符串
@org.springframework.stereotype.Controller
@RequestMapping("json")
public class JsonController {
   // 1. json数据可以通过实体类 map String来接收 2. 形参列表默认接受的是param注解 如果要接收json需要 @RequestBody
    @RequestMapping("data")
    public String paramData(@RequestBody String json){
        System.out.println(json);
        return json.toString();
    }
    @RequestMapping("data1")
    public String paramData1(@RequestBody Map<String, Object> map){
       return map.toString();
    }

    @RequestMapping("data2")
    public String paramData1(@RequestBody Person person){
        return person.toString();
    }
}
